/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import POJO.Sanphammoi;
import UTIL.HibernateUtil;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.classic.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 * @author nhlvu07db373
 */
public class SanphammoiDAO extends HibernateDaoSupport{
    private Session session;
    public List dsSanphamMoiAll() {
        List list = null;
        session = HibernateUtil.getSessionFactory().openSession();
        try {
            org.hibernate.Transaction ts = session.beginTransaction();
            Criteria crit = session.createCriteria(Sanphammoi.class);
            list = crit.list();
            ts.commit();
            session.flush();
        } catch (Exception ex) {
            System.err.println(ex.getMessage().toString());
        } finally {
            session.close();
        }
        return list;
    }
}
